String.prototype.lpad = function(padString, length)
{
    var str = this;
    while (str.length < length)
        str = padString + str;
    return str;
}

// source: http://stackoverflow.com/questions/45888/what-is-the-most-efficient-way-to-sort-an-html-selects-options-by-value-while-p
$.fn.sortSelectList = function()
{
    var my_options = $("#" + this.attr('id') + ' option');
    my_options.sort(function(a,b)
    {
        if (a.text > b.text) return 1;
        else if (a.text < b.text) return -1;
        else return 0
    });
    $("#" + this.attr('id')).empty().append(my_options);
}
